package com.wz.project.sap.DN_POST_SERIALNO.controller;

import java.util.List;

import com.wz.project.sap.DN_POST_SERIALNO.domain.ZflWmsDnPostSerialno;
import com.wz.project.sap.DN_POST_SERIALNO.service.IZflWmsDnPostSerialnoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * 内外向交货单过账serialnoController
 * 
 * @author wz
 * @date 2022-09-19
 */
@Controller
@RequestMapping("/DN_POST_SERIALNO/ZFL_WMS_DN_POST_SERIALNO")
public class ZflWmsDnPostSerialnoController extends BaseController
{
    private String prefix = "DN_POST_SERIALNO/ZFL_WMS_DN_POST_SERIALNO";

    @Autowired
    private IZflWmsDnPostSerialnoService zflWmsDnPostSerialnoService;

    @RequiresPermissions("DN_POST_SERIALNO:ZFL_WMS_DN_POST_SERIALNO:view")
    @GetMapping()
    public String ZFL_WMS_DN_POST_SERIALNO()
    {
        return prefix + "/ZFL_WMS_DN_POST_SERIALNO";
    }

    /**
     * 查询内外向交货单过账serialno列表
     */
//    @RequiresPermissions("DN_POST_SERIALNO:ZFL_WMS_DN_POST_SERIALNO:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ZflWmsDnPostSerialno zflWmsDnPostSerialno)
    {
        startPage();
        List<ZflWmsDnPostSerialno> list = zflWmsDnPostSerialnoService.selectZflWmsDnPostSerialnoList(zflWmsDnPostSerialno);
        return getDataTable(list);
    }

    /**
     * 导出内外向交货单过账serialno列表
     */
//    @RequiresPermissions("DN_POST_SERIALNO:ZFL_WMS_DN_POST_SERIALNO:export")
    @Log(title = "内外向交货单过账serialno", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ZflWmsDnPostSerialno zflWmsDnPostSerialno)
    {
        List<ZflWmsDnPostSerialno> list = zflWmsDnPostSerialnoService.selectZflWmsDnPostSerialnoList(zflWmsDnPostSerialno);
        ExcelUtil<ZflWmsDnPostSerialno> util = new ExcelUtil<ZflWmsDnPostSerialno>(ZflWmsDnPostSerialno.class);
        return util.exportExcel(list, "ZFL_WMS_DN_POST_SERIALNO");
    }

    /**
     * 新增内外向交货单过账serialno
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存内外向交货单过账serialno
     */
    @RequiresPermissions("DN_POST_SERIALNO:ZFL_WMS_DN_POST_SERIALNO:add")
    @Log(title = "内外向交货单过账serialno", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ZflWmsDnPostSerialno zflWmsDnPostSerialno)
    {
        return toAjax(zflWmsDnPostSerialnoService.insertZflWmsDnPostSerialno(zflWmsDnPostSerialno));
    }

    /**
     * 修改内外向交货单过账serialno
     */
    @GetMapping("/edit/{ZEILE}")
    public String edit(@PathVariable("ZEILE") String ZEILE, ModelMap mmap)
    {
        ZflWmsDnPostSerialno zflWmsDnPostSerialno = zflWmsDnPostSerialnoService.selectZflWmsDnPostSerialnoById(ZEILE);
        mmap.put("zflWmsDnPostSerialno", zflWmsDnPostSerialno);
        return prefix + "/edit";
    }

    /**
     * 修改保存内外向交货单过账serialno
     */
    @RequiresPermissions("DN_POST_SERIALNO:ZFL_WMS_DN_POST_SERIALNO:edit")
    @Log(title = "内外向交货单过账serialno", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ZflWmsDnPostSerialno zflWmsDnPostSerialno)
    {
        return toAjax(zflWmsDnPostSerialnoService.updateZflWmsDnPostSerialno(zflWmsDnPostSerialno));
    }

    /**
     * 删除内外向交货单过账serialno
     */
    @RequiresPermissions("DN_POST_SERIALNO:ZFL_WMS_DN_POST_SERIALNO:remove")
    @Log(title = "内外向交货单过账serialno", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(zflWmsDnPostSerialnoService.deleteZflWmsDnPostSerialnoByIds(ids));
    }
}
